Use latest version of GitHub Actions at seeding time. - #33
Merged
Merged
Conversation
When seeding a repository (or updating a pre-existing one), make sure
the GitHub Actions referenced in the GitHub workflows (if GitHub
workflows are used at all) are (i) referenced using a commit ID rather
than a tag name, and (ii) the commit ID points to the latest released
version.
This is done by having a small helper class (GitHubHelper) that
encapsulates the required calls to the GitHub API to get the latest
release information for a given project, and exposing that helper class
to the templates, so that we can write the following in a template:
```yaml
uses: actions/checkout@{{ gh.get_latest_release_sha("actions/checkout", "v7") }}
```
If we can get the required informations from GitHub, this will yield
```yaml
uses: actions/checkout@XXXXX # vX.Y.Z
```
where `vX.Y.Z` is the latest release for the `actions/checkout` project,
and `XXXXX` is the corresponding commit ID.
In the event we could _not_ get the latest release info, then this will
yield
```yaml
uses: actions/checkout@v7
```
closes INCATools/ontology-development-kit#1346
This commit does two things: First, it simplifies the handling of exceptions thrown by the requests library. All such exceptions are derived from the single RequestException class, so since we are not interested in distinguishing between the various error conditions, we can simply catch RequestException instead of trying to catch all the various subclasses. Second, it deals with the possibility that we could receive a response that is not strictly speaking an error (HTTP status code < 400), but that does not contain what we need either (e.g. status code == 204). This is probably highly unlikely, but if it does happen, we must not enter into an infinite loop.
matentzn
reviewed
Sep 23, 2026
matentzn
left a comment
Contributor
There was a problem hiding this comment.
Round 1 - I will check ones more after you re-request review
The `mhausenblas/mkdocs-deploy-gh-pages` action has not had a new release since 2023, but there has been some fixes on the master branch since then, so we need to use the master branch. We add a comment next to the tag for that action to make that a bit clearer.
If we somehow could not get the latest release tag for a given GitHub Action, cache the negative result, so that we don't try again a millisecond later the next time we need the tag for that action again.
matentzn
approved these changes
Sep 25, 2026
matentzn
left a comment
Contributor
There was a problem hiding this comment.
All my concerns addressed; some remaining doubts on the cost/benefit of not including a way to set a GH token but ok to try and retrofit if needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When seeding a repository (or updating a pre-existing one), make sure the GitHub Actions referenced in the GitHub workflows (if GitHub workflows are used at all) are (i) referenced using a commit ID rather than a tag name, and (ii) the commit ID points to the latest released version.
This is done by having a small helper class (GitHubHelper) that encapsulates the required calls to the GitHub API to get the latest release information for a given project, and exposing that helper class to the templates, so that we can write the following in a template:
If we can get the required informations from GitHub, this will yield
where
vX.Y.Zis the latest release for theactions/checkoutproject, andXXXXXis the corresponding commit ID.In the event we could not get the latest release info, then this will yield
closes INCATools/ontology-development-kit#1346